import { isContainArr } from "@/utils/validate";
import { useAuthStore } from "@/stores/auth";

// 单个权限验证
export function auth(value: string) {
  const authStore = useAuthStore();
  return authStore.buttonList.some((btn:string) => btn === value);
}

// 多个权限验证，只要有一个满足即可
export function auths(value: string[]) {
  const authStore = useAuthStore();
  return authStore.buttonList.some((btn:string) => value.indexOf(btn) != -1);
}

// 多个权限验证，全部满足
export function authAll(value: string[]) {
  const authStore = useAuthStore();
  return isContainArr(authStore.buttonList, value);
}
